package com.deanlib.cabinet.service.sync2;

import android.content.Context;
import android.content.Intent;

import androidx.annotation.NonNull;
import androidx.work.Worker;
import androidx.work.WorkerParameters;

import com.deanlib.cabinet.service.ResourceBackupService;
import com.deanlib.cabinet.service.ResourceCacheService;
import com.deanlib.cabinet.service.ResourceCollectService;
import com.deanlib.cabinet.service.ResourceSyncService;
import com.elvishew.xlog.XLog;

/**
 * Created by Dean on 2022/9/24
 */
public class ShadowWorker extends Worker {
    Context context;
    public ShadowWorker(@NonNull Context context, @NonNull WorkerParameters workerParams) {
        super(context, workerParams);
        this.context = context;
    }

    @NonNull
    @Override
    public Result doWork() {
        XLog.i("ShadowWorker doWork");
        context.startForegroundService(new Intent(context, ResourceCollectService.class));
        context.startForegroundService(new Intent(context, ResourceSyncService.class));
        context.startForegroundService(new Intent(context, ResourceCacheService.class));
        context.startForegroundService(new Intent(context, ResourceBackupService.class));
        return Result.success();
    }
}
